<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">盒子1</div>
    <div class="box">盒子</div>
    <div class="nav">
        <ul>
            <li>首页</li>
            <li>产品</li>
        </ul>
    </div>
    <script>
        var box = document.getElementsByClassName("box");
        console.log(box);
        console.log(box[0]);
        var firstbox = document.querySelector(".box");
        console.log(firstbox);
        var li = document.querySelector("li");
        console.log(li);
        var boxAll = document.querySelectorAll(".box");
        console.log(boxAll);
    </script>
</body>

</html>